package com.atguigu.tingshu.user.client;

import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.album.TrackInfo;
import com.atguigu.tingshu.model.user.UserPaidTrack;
import com.atguigu.tingshu.user.client.impl.UserInfoDegradeFeignClient;
import com.atguigu.tingshu.vo.order.OrderInfoVo;
import com.atguigu.tingshu.vo.user.UserInfoVo;
import com.atguigu.tingshu.vo.user.UserPaidRecordVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 产品列表API接口
 * </p>
 *
 * 
 */
@FeignClient(value = "service-user", fallback = UserInfoDegradeFeignClient.class)
public interface UserInfoFeignClient {
    //远程调用接口:根据用户id获取用户信息
    @GetMapping("api/user/userInfo/getUserInfoVo/{userId}")
    Result<UserInfoVo> getUserInfoVo(@PathVariable(value = "userId") Long userId);


    //判断用户是否购买过声音
    @PostMapping("api/user/userInfo/userIsPaidTrack/{userId}/{albumId}")
     Result<Map<Long,Integer>>userIsPaidTrack(@PathVariable(value = "userId") Long userId,
                                                    @PathVariable(value = "albumId") Long albumId,
                                                    @RequestBody List<Long> trackIdList);


    //判断用户是否购买过专辑
    @GetMapping("api/user/userInfo/isPaidAlbum/{itemId}/{userId}")
     Result<Boolean> isPaidAlbum(@PathVariable(value = "itemId")  Long itemId,
                                       @PathVariable(value = "userId") Long userId);
    //查询用户购买过哪些声音的id

    @GetMapping("api/user/userInfo/findUserPaidTrack/{userId}/{albumId}")
    Result<List<Long>> findUserPaidTrackId(@PathVariable(value = "userId") Long userId,
                                                @PathVariable(value = "albumId") Long albumId);

    //添加购买记录
    @PostMapping("/api/user/userInfo/savePaidRecord")
    Result savePaidRecord(@RequestBody UserPaidRecordVo userPaidRecordVo);

}